home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / cctools / as / hash.h < prev    next >
C/C++ Source or Header  |  1993-09-09  |  2KB  |  61 lines

  1. /* hash.h - for hash.c
  2.    Copyright (C) 1987 Free Software Foundation, Inc.
  3.  
  4. This file is part of GAS, the GNU Assembler.
  5.  
  6. GAS is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GAS is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GAS; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. struct hash_entry
  21. {
  22.   char *      hash_string;    /* points to where the symbol string is */
  23.                 /* NULL means slot is not used */
  24.                 /* DELETED means slot was deleted */
  25.   char *      hash_value;    /* user's datum, associated with symbol */
  26. };
  27.  
  28.  
  29. #define HASH_STATLENGTH    (6)
  30. struct hash_control
  31. {
  32.   struct hash_entry * hash_where; /* address of hash table */
  33.   int         hash_sizelog;    /* Log of ( hash_mask + 1 ) */
  34.   int         hash_mask;    /* masks a hash into index into table */
  35.   int         hash_full;    /* when hash_stat[STAT_USED] exceeds this, */
  36.                 /* grow table */
  37.   struct hash_entry * hash_wall; /* point just after last (usable) entry */
  38.                 /* here we have some statistics */
  39.   int hash_stat[HASH_STATLENGTH]; /* lies & statistics */
  40.                 /* we need STAT_USED & STAT_SIZE */
  41. };
  42.  
  43.  
  44. /*                        returns          */
  45. extern struct hash_control *hash_new(    /* [control block]      */
  46.     void);            
  47. extern char *hash_insert(        /* error string           */
  48.     struct hash_control *handle,
  49.     char *string,
  50.     char *value);
  51. extern char *hash_apply(        /* 0 means OK             */
  52.     struct hash_control *handle,
  53.     char *(*function)(char *hash_string, char *hash_value));
  54. extern char *hash_find(            /* value                  */
  55.     struct hash_control *handle,
  56.     char *string);
  57. extern char *hash_jam(            /* error text (internal)  */
  58.     struct hash_control *handle,
  59.     char *string,
  60.     char *value);
  61.